﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.BLL;
using PBOffice.Models;

public partial class ScheduleManager_MyNote : System.Web.UI.Page
{
    List<MyNote> list = new MyNoteManager().GetAllNote();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.DataList1.DataSource = list;
            this.DataList1.DataBind();
        }

    }
    //protected void DataList1_DataBinding(object sender, EventArgs e)
    //{
    //    foreach (MyNote item in list)
    //{
    //    (this.DataList1.ItemTemplate.FindControl("lbTitle") as Label).Text = item.NoteTitle; 
    //}
        
    //}
    //protected void lbTitle_Click(object sender, EventArgs e)
    //{
        
    //    Response.Redirect(string.Format("AddSchedule.aspx?title={0}",(this.DataList1.FindControl("lbTitle") as Label).Text));
    //}
    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName=="click")
        {
          int id=Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);
            Response.Redirect(string.Format("AddSchedule.aspx?id={0}",id));
        }
    }
}